package com.bw.controller.invoice;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.bw.controller.orders.PiOrderLogController;
import com.bw.entity.invoice.PiInvoiceLog;
import com.bw.req.InvoiceLog;
import com.bw.req.OrderLog;
import com.bw.resp.ResponseResult;
import com.bw.service.invoice.IPiInvoiceLogService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lizhengqian
 * @since 2020-06-19
 */
@RestController
@RequestMapping("invoiceLog")
public class PiInvoiceLogController {

    @Autowired
    private IPiInvoiceLogService piInvoiceLogService;

    private final Logger logger = LoggerFactory.getLogger(PiOrderLogController.class);

    /**
     * @Description:订单记录
     * @Author: 周明丽
     * @Date: 2020/6/21 10:51
     * @param id:
     * @return: com.bw.resp.ResponseResult
     **/
    @GetMapping("list/{id}")
    public ResponseResult list(@PathVariable("id") Long id) {
        logger.info("发票记录开始");
        ResponseResult result = ResponseResult.SUCCESS();

        try {

            List<InvoiceLog> piInvoiceLog = piInvoiceLogService.listLog(id);
            result.setResult(piInvoiceLog);

        }catch (Exception e){
            logger.error("发票记录失败"+e.toString());
            result.setSuccess(false);
            result.setMessage("发票记录失败:" + e.toString());
        }
        logger.info("发票记录结束");
        return result;
    }


}
